# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Veeti Paananen <veeti.paananen@rojekti.fi>

pkgname=cmark
pkgver=0.30.2
pkgrel=1
pkgdesc='CommonMark parsing and rendering library and program in C'
arch=(x86_64)
url='https://github.com/jgm/cmark'
license=('custom:BSD2')
depends=(glibc)
makedepends=(cmake python)
source=(https://github.com/jgm/cmark/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha512sums=('aaa9b2103cf89c522f9b42a2b43c07ecf75e07eb42214c0be5de17682ea1faf9c85e3dd28fe91d446b69a34f9980bcab6e276a99b42540c40c9ee1481b3a0d17')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMARK_STATIC=OFF
  cmake --build build
}

check() {
  cmake --build build --target test
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  install -Dm 644 $pkgname-$pkgver/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}
